package com.gp.dwt.controller;

import com.gp.dwt.base.Result;
import com.gp.dwt.dto.UserApplyDto;
import com.gp.dwt.service.RoleService;
import com.gp.entity.Role;
import com.gp.entity.UserRoleApply;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 小杜
 */
@RestController
@RequestMapping("/role")
@Api(value = "角色管理接口",tags = "角色管理接口")
public class RoleContoller {

    @Autowired
    private RoleService roleService;
    @ApiOperation(value = "新增角色")
    @PostMapping("/addRole")
    public Result addRole(@RequestBody Role role){
        return roleService.addRole(role);
    }
    @ApiOperation(value = "用户申请角色")
    @PostMapping("/applyRole")
    public Result userApply(@RequestBody UserRoleApply userRoleApply){
        return roleService.userApplyRole(userRoleApply);
    }
    @ApiOperation(value = "查看角色申请列表")
    @PostMapping("/applyList")
    public Result applyList(){
        return roleService.userApplyList();
    }
    @ApiOperation(value = "审核角色申请")
    @PostMapping("/auditApply")
    public Result auditApply(@RequestBody UserApplyDto userApplyDto){
        return roleService.auditApply(userApplyDto);
    }
}
